<!doctype html>
<html  class="x-admin-sm">
<head>
	<meta charset="UTF-8">
	<title>后台登录-__APPNAME__</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="__PUBLIC__static/css/font.css">
    <link rel="stylesheet" href="__PUBLIC__static/css/login.css">
	  <link rel="stylesheet" href="__PUBLIC__static/css/xadmin.css">
    <script type="text/javascript" src="__PUBLIC__static/js/jquery.min.js"></script>
    <script src="__PUBLIC__static/lib/layui/layui.js" charset="utf-8"></script>
    <!--[if lt IE 9]>
      <script src="__PUBLIC__static/js/html5.min.js"></script>
      <script src="__PUBLIC__static/js/respond.min.js"></script>
    <![endif]-->
    <script src="__PUBLIC__static/js/md5.js"></script>
</head>
<body class="login-bg">
    
    <div class="login layui-anim layui-anim-up">
        <div class="message">__APPNAME__-管理登录</div>
        <div id="darkbannerwrap"></div>
        
        <form method="post" class="layui-form" >
            <input name="username" placeholder="账号"  type="text" lay-verify="uname" class="layui-input" >
            <hr class="hr15">
            <input name="password" lay-verify="pass" placeholder="密码"  type="password" class="layui-input">
            <hr class="hr15">
            <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
            <hr class="hr20" >
        </form>
    </div>

    <script>
        $(function  () {
            layui.use('form', function(){
              var form = layui.form;
              // layer.msg('玩命卖萌中', function(){
              //   //关闭后的操作
              //   });
                //自定义验证规则
                form.verify({
                    uname: function(value){
                        if(value.length < 5){
                            return '账号至少得5个字符啊';
                        }
                    }
                    ,pass: [
                        /^[\S]{6,12}$/
                        ,'密码必须6到12位，且不能出现空格'
                    ]
                });
              //监听提交
              form.on('submit(login)', function(data){
                // alert(888)
                  //console.log(data.field.username);
                 $.getJSON("{:url('admin/login/check')}",{'uname':data.field.username,'upass':hex_md5(data.field.password)},function(res){
                     console.log(res.statusCode);
                     if(parseInt(res.statusCode)==200){
                            layer.msg(res.message,function(){
                                window.location.href = "{:url('admin/index/index')}";
                            });
                        }else{
                            layer.msg(res.message);
                        }
                 });
                  return false;
              });
            });
        })
    </script>
    <!-- 底部结束 -->

</body>
</html>